package com.iiot.stream.tools;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author dzm
 * @create 2018-06-15-13:58
 */
public class TimeTransform {
    // 格式化成日期
    public static String timestampToDate(Long timestamp){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String date = simpleDateFormat.format(new Date(timestamp));
        return date;
    }
    // 格式化成时分秒
    public static String timestampToSecond(Long timestamp){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String second = simpleDateFormat.format(new Date(timestamp));
        return second;
    }

}
